<template>
  <div class="root">
    <div class="nav">
      <div class="back" @click="back">
        <i class="el-icon-back"></i>
        <span>返回</span>
      </div>
    </div>
    <el-card class="card" v-for="(item,index) in detailMusic" :key="index">
      <div class="title">
        {{item.musicName}}
      </div>
      <div class="mainContainer">
        <div class="imgContainer">
          <img :src="item.musicPic" alt="">
        </div>
        <div class="dec">
          <div class="author">
            <i class="el-icon-user"></i>
            <span>{{item.singerName}}</span>
          </div>
          <div class="time">
            <span>发行时间 : {{item.updataTime}}</span>
          </div>
        </div>
      </div>
      <div class="btn" @click="paly(item.musicId)">
        <i class="el-icon-video-play"></i>
        <span>播放</span>
      </div>
    </el-card>
    <div class="aboutAuthor" v-for="item in detailMusic" :key="item.musicId">
      <h3>歌手信息</h3>
      <div class="singerPic">
        <img :src="item.singerPic" alt="">
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data(){
    return {
      id:this.$router.currentRoute.params.id,
      detailMusic:[]
    }
  },
  created() {
    this.getDetail()
  },
  methods:{
    async getDetail(){
      const res = await this.$http.post('/api/Detail', this.id)
      this.detailMusic = res.data
      console.log(this.detailMusic)
    },
    back(){
      this.$router.push('/home')
    },
    paly(id){
      this.$router.push('/player'+id)
    }
  }
}
</script>

<style lang="less" scoped>
  *{
    margin:0;
    padding: 0;
    // box-sizing: border-box;
  }
  .root{
    width: 70vw;
    // background-color: #2ecc71;
    // height: 100vh;
    margin:0 auto;
    margin-top: 15px;
  }
  .nav{
    width: 70vw;
    height: 80px;
    background-color: rgb(244, 244, 244);
    display: flex;
    align-items: center;
    .back{
      display: flex;
      align-items: center;
      cursor: pointer;
      margin-left: 20px;
    }
  }
  i{
      font-size:2.2em;
      margin-left: 20px;
  }
  span{
    font-size: 1.2em;
    color: #aaa;
    margin-left: 10px;
  }
  .title{
    font-size: 22px;
    color: #666;
    margin-left: 25px;
    line-height: 40px;
    // background-color: skyblue;
  }
  .mainContainer{
    width: 100%;
    // height: 40vh;
    // background-color: skyblue;
    margin-top: 10px;
    display: flex;
    align-items: center;
    .imgContainer{
      width: 290px;
      height: 290px;
      // background-color: red;
      margin-left: 20px;
      // margin-top: 30px;
      img{
        width: 100%;
        height: 100%;;
      }
    }
  }
  .dec{
    width: 300px;
    height: 290px;;
    // background-color: red;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: black;
    .author{
      margin-bottom: 10px;
      i{
        font-size: 1.5em;
        color: black;
      }
      span{
        font-size: 18px;
        color: black;
      }
    }
    .time{
       margin-left: 10px;
       color: black;
      span{
        font-size: 15px;
        color: black;
      }
    }
  }
  .aboutAuthor{
    width: 70vw;
    height: 40vh;
    background-color: rgb(244, 244, 244);
    h3{
      padding-top: 10px;
      margin-left: 20px;
    }
    .singerPic{
      width: 290px;
      height: 290px;
      // background-color: skyblue;
      margin-top: 15px;
      margin-left: 40px;
      border: 5px solid white;
      img{
        width: 100%;
        height: 100%;
      }
    }
  }
  .card{
    position: relative;
  }
  .btn{
    width: 100px;
    height: 38px;;
    // height: 50px;
    // background-color: skyblue;
    position: absolute;
    bottom: 20px;
    right: 20px;;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    background-color: rgb(110, 238, 108);
    i{
      font-size: 2em;
      color: white;
      margin: 0;
      padding: 0;
      margin-right: 5px;
    }
    span{
      font-size: 18px;
      color: white;
      margin: 0;
      padding: 0;
    }
  }
</style>
